<fieldset>
	<legend><?php echo t('PART_WORKING_PROCESS','profile') ?></legend>
	<table width="970px">
		<tr>
			<td width="50%" style="vertical-align: top">				
				<table class="grid working" id="workingprocesses">
					<tbody>
						<tr>
							<th rowspan="2"><?php echo t('LBL_WORKING_TIME', 'workingProcess') ?></th>
							<th rowspan="2"><?php echo t('LBL_COMPANY', 'workingProcess') ?></th>
							<th rowspan="2"><?php echo t('LBL_JOB_DESCRIPTION', 'workingProcess') ?></th>
							<th colspan="2"><?php echo t('LBL_SALARY', 'workingProcess') ?></th>							
						</tr>
						<tr>
							<th><?php echo t('LBL_BASIC_SALARY', 'workingProcess') ?></th>
							<th><?php echo t('LBL_REAL_SALARY', 'workingProcess') ?></th>
						</tr>
						<?php
						$workingIndex = 0;
						foreach ( $model->workingProcesses as $workingId => $work ) :
							if ($work != null && (isset($work->working_time) || isset($work->company) || isset($work->job_description) || 
								isset($work->basic_salary) || isset($work->real_salary))) {
								$updated_fields = array();
								if($work->updated_fields != NULL)
									$updated_fields = explode(',', $work->updated_fields);
								$this->renderPartial ( '_workingform', array (
										'model' => $work,
										'translatedModel' => $translatedModel->workingProcesses[$workingId],
										'updated_fields' => $updated_fields,
										'index' => $workingId 
								) );
							}
							$workingIndex++;
						endforeach; 
						?>
					</tbody>
				</table>
			</td>
	
	</table>
</fieldset>
<?php
Yii::app()->clientScript->registerScript('loadworkingprocess', '
var _index = ' . $workingIndex . ';
$("#loadWorkingProcessByAjax").click(function(e){
    e.preventDefault();
    var _url = "' . Yii::app()->controller->createUrl("loadWorkingProcessByAjax", array("load_for" => $this->action->id)) . '&index="+_index;
    $.ajax({
        url: _url,
        success:function(response){
            $("#workingprocesses").append(response);            
        }
    });
    _index++;
});
', CClientScript::POS_END);
?>
